package week3.day18;

/**
 * @Author fengzihao
 * @Date 2024-05-02 19:32
 */
public class CountingWords {
    public static void main(String[] args) {
        String str = "peter piper picked a peck of pickled peppers";
        String[] strs = str.split(" ");
        int count = 0;
        for (int i = 0; i < strs.length; i++) {
            if (strs[i].startsWith("p"))
                count++;
        }
        System.out.println("count = " + count);
    }
}
